Repository navigation
DEVOPS-1320: speedup pre-commit hook extracting issue number from branch - #22
Conversation
|
|
There was a problem hiding this comment.
🟡 Changes recommended
The dependency-group migration is incompatible with CI’s pinned Poetry 2.1.3, and the hook’s hard-coded .git path can cause incorrect JIRA-ID handling when GIT_DIR selects another repository.
2 open issues
What changed in this PR
This PR updates packaging and branch detection for the pre-commit hooks, adding Git-based dynamic versioning and direct reading of repository metadata.
Changes:
- Replace Git branch-list parsing with HEAD and rebase-state inspection, with tests for normal repositories and worktrees.
- Introduce generated version files, fallback version handling, and updated Poetry configuration.
- Refresh pre-commit tool revisions and copyright notices.
| File | Description |
|---|---|
tests/version_test.py |
Test fallback versions and generated-version consistency. |
tests/git_message_hook_test.py |
Cover repository discovery, worktrees, and rebase states. |
tests/check_copyright_test.py |
Update copyright year. |
tests/__init__.py |
Update copyright year. |
README.rst |
Refresh copyright notices and company name. |
pyproject.toml |
Configure dynamic versioning and migrate development dependency groups. |
poetry.lock |
Update lockfile format and dependency metadata. |
mirageoscience/hooks/git_message_hook.py |
Read branch information from Git metadata files. |
mirageoscience/hooks/check_copyright.py |
Update copyright year. |
mirageoscience/hooks/__init__.py |
Load the generated version with a dated development fallback. |
mirageoscience/__init__.py |
Update copyright year. |
LICENSE |
Refresh copyright years and company name. |
.pre-commit-config.yaml |
Update hook revisions. |
.gitignore |
Ignore generated version files. |
Review effort: Balanced
|
|
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
During a rebase: - preserves any JIRA ID already in that message, even if it does not match JIRA ID from the branch. - add JIRA ID if missing
There was a problem hiding this comment.
🟡 Changes recommended
Branch discovery no longer finds the enclosing repository from subdirectories, causing missing-JIRA validation errors and preventing branch ticket IDs from being added during message preparation.
1 open issue
2 resolved since last review
Review effort: Balanced
RomFloreani
left a comment
There was a problem hiding this comment.
See small comment about dead code
There was a problem hiding this comment.
🟡 Changes recommended
In trailer mode, the commit-message hook selects a leading blank line as the subject instead of the actual subject, causing messages with a sufficiently long subject and an issue trailer to fail the minimum-length check.
1 open issue
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Replay handling depends on Git’s runtime hook arguments and transient rebase/cherry-pick state files. Clean cherry-pick behavior remains uncertain because CHERRY_PICK_HEAD is not guaranteed to exist, so integration verification is still needed.
No open issues 🎉
1 resolved since last review
Review effort: Lite
|
here is the way it behaves for rebase:
Other said the prepare-message hooks does run while the check-message does not. This is the behaviour I intended. |


DEVOPS-1320 - speedup pre-commit hook extracting issue number from branch